import java.util.Arrays;
import java.util.Scanner;

public class Test2 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int m = scanner.nextInt();
        int[] arr1 = new int[n];
        int[] arr2 = new int[n];
        for(int i = 0; i < n;i++) {
            arr1[i] = scanner.nextInt();
        }
        for(int i = 0; i < n;i++) {
            arr2[i] = scanner.nextInt();
        }
        Arrays.sort(arr1);
        boolean tmp = true;
        for(int i = 1; i < n; i++) {
            int count = 0;
            for(int j = i; j >= 0; j--) {
                count += (arr1[i] - arr1[j]);
            }
                if (count > m) {
                    System.out.println(arr1[i - 1]);
                    tmp = false;
                    break;
                }
                if (count == m) {
                    System.out.println(arr1[i]);
                    tmp = false;
                    break;
                }
        }
        if(tmp) {
            System.out.println(arr1[0]);
        }
     }
}
